﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Singleton
{
     public sealed class Singleton1
    {
        private static Singleton1 _instance;

        public static Singleton1 Instance
        {
            get
            {
                return _instance ?? (_instance = new Singleton1()); 
            }
        }

        private Singleton1()
        {

        }

    }

    public class Singleton2
    {
        private static readonly Singleton2 _instance = new Singleton2();

        public static Singleton2 Instance
        {
            get
            {
                return _instance; 
            }
        }

        private Singleton2()
        {

        }

    }
}
